<?
require_once("conn.php");
$dt = $_REQUEST["dt"];

if($dt == ""){
	$dt = date("Y-m-d");
}
?>
<script type="text/javascript">
	$().ready(function() {
		$("#sell_date").datepicker({
			dateFormat: 'yy-mm-dd',
			onSelect: function(dateText, inst) {
				updateSellReport();
			}
		});
	});
  
</script>
<table width="500">
	<tr>
		<td><a href="#" onclick="log_buy_report()">Buy Report</a></td>
		<td><a href="#" onclick="log_sell_report()">Sell Report</a></td>
		<td><a href="#" onclick="log_sum_report()">Summary Report</a></td>
		<td><a href="#" onclick="log_stock_report()">Stock Report</a></td>
	</tr>
	<tr>
		<td colspan="3">&nbsp;</td>
	</tr>
	<tr>
		<td colspan="3">Date <input type="text" id="sell_date" readonly></td>
	</tr>
</table>
<?

		$sql = "SELECT * FROM sell_detail WHERE date(Sell_Date)='".$dt."' ORDER BY Sell_ID;";
		$query = mysql_query($sql);
		if(mysql_num_rows($query) > 0){
		?>
		<table width="750">
			<tr>
				<td colspan="7"><span align="right" style="float:right;" ><a href="logSellexcel.php?dt=<?=$dt?>" target="_blank"><img src="images/excel_icon.jpg" width="25" border="0"></a></span></td>
			</tr>
		</table>
		<table width="750" border="1" style="border-collapse:collapse">			
			<tr>
				<td>Bill No</td>
				<td>Barcode</td>
				<td>Product Name</td>
				<td>Qty</td>
				<td>Price</td>
				<td>Total</td>
				<td>Date</td>
				<td>Sell By</td>
			</tr>
		<?
		while($row = mysql_fetch_array($query)){
		?>
			<tr>
				<td><?=$row["Sell_ID"]?></td>
				<td><?=$row["Barcode"]?></td>
				<td><?=$row["Product_Name"]?></td>
				<td><?=$row["Qty"]?></td>
				<td><?=$row["Price"]?></td>
				<td><?=($row["Qty"] * $row["Price"])?></td>
				<td><?=$row["Sell_Date"]?></td>
				<td><?=$row["Sell_By"]?></td>
			</tr>
		<?
		}
		}else{
		?>
			No Data
		<?
		}
	?>
</table>